﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Documents;

namespace ExtendedEditor.Painter
{
	public class ParagraphMetadataCollection
	{
		public ParagraphMetadataCollection()
		{
			database = new Dictionary<Guid, ParagraphMetadata>();
		}

		public void HandleParagraph(Paragraph paragraph)
		{
			if (paragraph == null) return;
			
			Guid id = Guid.NewGuid();

			if (paragraph.Tag is Guid) id = (Guid)paragraph.Tag;
			else paragraph.Tag = id;

			if (!database.ContainsKey(id)) database.Add(id, new ParagraphMetadata(paragraph));

			foreach (var item in database[id].Paragraph.Inlines)
			{
				//database[id].RunMetadataCollection.Clear();
				//database[id].RunMetadataCollection.Add(new RunMetadata(item as Run));
			}
			
		}

		Dictionary<Guid, ParagraphMetadata> database;
	}
}
